// 导入 vue 的第三方库
// 路由库 vue-router
import { createWebHistory, createRouter } from "vue-router";

// 导入所有要访问的页面
import Login from "@/views/login.vue";
import HomeLayout from "@/views/main/HomeLayout.vue";
import StudentList from "@/views/main/children/student_list.vue";
import Test from "@/views/main/children/test.vue";
import Home from "@/views/main/children/home.vue";
//import NotFound from "@/views/notfound.vue";


const routes = [
{
    path: "/",
    name: "index",
    component: HomeLayout,
    meta: {
      requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
    },
    children: [
      {
        path: "/",
        name: "home",
        component: Home
      },
      {
        path: "/stulist",
        name: "stulist",
        component: StudentList
      },
      {
        path: "/test",
        name: "test",
        component: Test
      }
    ]
  },
  {
    path: "/login",
    name: "login",
    component: Login,
    keepAlive: false
  },
  
];

//创建网站路由
const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;